# Contributor: Leo <thinkabit.ukim@gmail.com>
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libnice
pkgver=0.1.19
pkgrel=0
pkgdesc="GLib ICE implementation"
options="!check" # Testsuite fails
url="https://libnice.freedesktop.org/"
arch="all"
license="LGPL-2.1-or-later AND MPL-1.1"
makedepends="
	glib-dev
	gnutls-dev
	gstreamer-dev
	gobject-introspection-dev
	gtk-doc
	meson"
subpackages="
	$pkgname-dbg
	$pkgname-dev
	$pkgname-gstreamer:_gst"
source="https://nice.freedesktop.org/releases/libnice-$pkgver.tar.gz
	libnice-meson-0.58.patch "

build() {
	# XXX: docs fail to build because of libnice not being built first,
	# race condition
	abuild-meson \
		-Dgtk_doc=disabled \
		-Dtests=disabled \
		-Dexamples=disabled \
		-Dintrospection=enabled \
		-Dcrypto-library=gnutls \
		-Dgstreamer=enabled \
		-Dgupnp=disabled builddir
	meson compile ${JOBS:+-j ${JOBS}} -C builddir
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C builddir
}

_gst() {
	pkgdesc="Gstreamer 1.0 plugin for libnice"
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/gstreamer-1.0 "$subpkgdir"/usr/lib/
}

sha512sums="
1c63cc0b7655186fd6f83da4dd607183d6ccfab9b7ad7189c1bea2ba7413183f24076aba5d6c7231d2ab3fbd471827256729a8a0c0d1bda48803586e68b3778b  libnice-0.1.19.tar.gz
c59962a20d554da909a993f5d83d8d96da927d0ac94cfef2f699468326509f5715e8f7054badd25d07819b733dcea13c308b72aff170c013f7004dadba960dd7  libnice-meson-0.58.patch
"
